import { createPinia } from 'pinia'
// 解决引入 createPersistedState 报错 -> pnpm add destr deep-pick-omit
import { createPersistedState } from 'pinia-plugin-persistedstate'

const pinia = createPinia()

pinia.use(
  createPersistedState({
    storage: {
      // 改写 本地存储 storage
      getItem(key) {
        return uni.getStorageSync(key)
      },
      setItem(key, value) {
        uni.setStorageSync(key, value)
      }
    }
  })
)

export default pinia
